<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
<%@ include file="/common/meta.jsp"%>
<title>VTC - Holistic category - HPP</title>
<%@ include file="/common/css_js.jsp"%>
<script>
function selectAllRoles(){
	var cb=$("#selectAll");
	if(cb.attr("checked")==true){
	    //根据名字获取所有在同一组的checkbox
		var cbRoleCodes=document.getElementsByName("selectRoleCodes")
		for(i=0;i<cbRoleCodes.length;i++){
			cbRoleCodes[i].checked=true;
		}
	}else{
		var cbRoleCodes=document.getElementsByName("selectRoleCodes")
		for(i=0;i<cbRoleCodes.length;i++){
			cbRoleCodes[i].checked=false;
		}
	}
}
function save(){
	$("#emailRoleForm").attr('action','update-email-setting.action');
	$("#emailRoleForm").submit();
	CE.close();
}
</script>
</head>
<body>
	<div class="bodyBlank">
		<div class="padding">
			<!-- InstanceBeginEditable name="content" -->
			<div class="bodyBlank2">
				<div class="pageTitle">Role</div>
				<div class="sListBorder">
					<div class="sList">
					<s:form id="emailRoleForm" name="emailRoleForm" method="post">
					<s:hidden name="emailSetting.emailNotificationType"></s:hidden>
						<table width="100%" class="sTable" cellpadding="0" cellspacing="0"
							border="0">
							<tr>
							<td class="sTh checkbox"><input class="inputCheckbox"
								type="checkbox" id="selectAll" name=""
								onclick="selectAllRoles()" /></td>
							<td class="sTh">Role</td>
						</tr>
							<s:iterator value="roleList" var="roleVar">
								<tr class="sRow2">
									<td class="sTh checkbox"><s:checkbox name="selectRoleCodes"
											value="roleMap[#roleVar.id.roleCode]!=null?1:0"
											fieldValue="%{#roleVar.id.roleCode}"></s:checkbox></td>
									<td class="sCell"><s:property value="#roleVar.id.roleCode" />
									</td>
								</tr>
							</s:iterator>
						</table>
						</s:form>
					</div>
					<div class="btnSet btnSetTypeA">
						<div class="left">
							<div class="button">
								<div class="left">
									<div class="right">
										<input class="inputButton" type="button" id="" name=""
											value="Save" onclick="save()" />
									</div>
								</div>
							</div>
							<div class="button">
								<div class="left">
									<div class="right">
										<input class="inputButton" type="button" id="" name=""
											value="Cancel" onclick="CE.close()" />
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!-- InstanceEndEditable -->
		</div>
	</div>
</body>